<?php

namespace App\Http\Controllers\Api\V1;

use Illuminate\Http\Request;

use Cblink\Region\Region;

use App\Http\Resources\V1\RegionResource;

class RegionController extends Controller
{
    public function index(Request $request, Region $region)
    {
        $regions = $region->allProvinces();

        return RegionResource::collection($regions);
    }

    public function children($id, Region $region)
    {
        $regions = $region->nest($id)->first()->children()->get();

        return RegionResource::collection($regions);
    }
}
